let stealDegree = 0
let degree = 0
let lastUncommonDish = null

const storageKey = 'bili-2020-year'
const menu = []
const uncommonMenu = []

// 数据初始化
const dataInit = () => {
    let data = localStorage.getItem(storageKey)
    if (data !== null) {
        console.log('成功读取存档')
        data = JSON.parse(data)
        degree = data.degree
        stealDegree = data.stealDegree
        data.menu.map(i => menu.push(i))
        data.uncommonMenu.map(i => uncommonMenu.push(i))

    } else {
        console.log('木有存档')
    }
}

const showMenu = () => {
    let str = '总共加菜 ' + degree + ' 次'
    str += '\n统计到普通食材 ' + menu.length + ' 种 \n'
    for (let i = 0; i < menu.length; i++) {
        const dish = menu[i]
        str += dish
    }
    str += '\n统计到稀有食材 ' + uncommonMenu.length + ' 种 \n'
    for (let i = 0; i < uncommonMenu.length; i++) {
        const dish = uncommonMenu[i]
        str += dish + '，'
    }
    console.log(str)
}

dataInit()
showMenu()